home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Devices / PACKman C / main.c next >
Encoding:
C/C++ Source or Header  |  1994-10-28  |  3.2 KB  |  94 lines  |  [TEXT/KAHL]

  1. //--------------------------------------------------------------------------
  2. //                                                                            
  3. //        PACKman                                                    
  4. //            by Scott “Zz” Zimmerman & Nick Thompson                                                    
  5. //                                                                            
  6. //        Description:    This snippet shows how to implement a simple
  7. //                        Chooser Package, updated from Scott “Zz” Zimmerman's 
  8. //                        PACKman pascal sample                                        
  9. //                                                                            
  10. //        Version:        1.0 Completed 10/19/94                                
  11. // 
  12. //
  13. // Modification History:
  14. //
  15. //    10/18/94        nick    converted from Pascal
  16. //    10/19/94        nick    updated to reflect info in IM: Devices (pages 1-42 ff)
  17. //                            this sample is think C specific
  18. //
  19. // To do:
  20. //        implement for metrowerks and MPW C
  21. //
  22. //    Copyright:    © 1989-94 by Apple Computer, Inc., all rights reserved.
  23. //--------------------------------------------------------------------------
  24.  
  25. #define        VERSION            10            // Version (1.0)
  26. #define        DEVICEID        128            // Device ID 
  27.  
  28. extern pascal OSErr MyPackage( short message, short caller, StringPtr objName, StringPtr objectName, long p1, long p2) ;
  29.  
  30.     // Device package flags
  31.     //
  32.     // we work out the flags by seeting the appropriate bit in the longword.
  33.     // for our extension we want to set the following flags:
  34.     //
  35.     //    usesAppleTalk,
  36.     //    noPAP,
  37.     //    noPostScript,
  38.     //    noMultiples,
  39.     //    noLeftButton,
  40.     //    noRightButton,
  41.     //    usesSavedZoneName,
  42.     //    noActualZoneNames,
  43.     //    acceptsInit,
  44.     //    acceptsNewSel,
  45.     //    acceptsFillList,
  46.     //    acceptsGetSel,
  47.     //    acceptsSelect,
  48.     //    acceptsDeselect,
  49.     //    ignoresTerminate,
  50.     //
  51.     // This equates to the following:
  52.     //
  53.     // 1098 7654 3210 9876 5432 1098 7654 3210  - bit position
  54.     // 1000 0010 0000 0001 1111 0000 0000 0000  - value (see Device package flags, below)
  55.     // 8    2    0    1    F    0    0    0     - this is 0x8201F800
  56.     //
  57.     // the meaning of the flags is as follows:
  58.     //
  59.     // Bit        Meaning    
  60.     //
  61.     // 31        Set if an AppleTalk device    
  62.     // 30–29    Reserved (clear to 0)    
  63.     // 28        Set if the device package can have multiple instances selected at once    
  64.     // 27        Set if the device package uses the Left button    
  65.     // 26        Set if the device package uses the Right button    
  66.     // 25        Set if no zone name has been saved    
  67.     // 24        Set if the device package uses actual zone names    
  68.     // 23–21    Reserved (clear to 0)    
  69.     // 20        Set if the device uses the On and Off radio buttons and radio button label    
  70.     // 19–17    Reserved (clear to 0)    
  71.     // 17        Set if the device package accepts the chooserInitMsg message    
  72.     // 16        Set if the device package accepts the newSelMsg message    
  73.     // 15        Set if the device package accepts the fillListMsg message    
  74.     // 14        Set if the device package accepts the getSelMsg message    
  75.     // 13        Set if the device package accepts the selectMsg message    
  76.     // 12        Set if the device package accepts the deselectMsg message    
  77.     // 11        Set if the device package accepts the terminateMsg message    
  78.     // 10–0        Reserved (clear to 0)
  79.  
  80. main()
  81. {
  82.     // set up the header for the PACK resource
  83.     asm {
  84.             bra.s        @start        // branch to label start
  85.             dc.w        DEVICEID    // declare word const as the pack device ID
  86.             dc.l        'PACK'        // the resource type
  87.             dc.w        0xF000        // this is -4096, for the chooser
  88.             dc.l        VERSION        // the version number of our package
  89.             dc.l        0x8201F800    // Device package flags (see long comment above)
  90.         start:
  91.             jmp            MyPackage
  92.     }
  93. }
  94.